Repository navigation
Slack account link, agent application feed, and agent decisions on an admin's behalf - #270
Merged
Merged
Conversation
codeforphilly-bot
added a commit
that referenced
this pull request
Nov 29, 2026
The three closeout commits were made before the pull request existed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
codeforphilly-bot
added a commit
that referenced
this pull request
Nov 30, 2026
Operator-approved on PR #270: the site links an account to a Slack user by itself when the user found by its email has the handle the site asserted at sign-in. Scope, approach and validation amended; the earlier closeout's ticks stand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
codeforphilly-bot
added a commit
that referenced
this pull request
Nov 30, 2026
…agree Operator-approved design on PR #270. With its own read-only token (SLACK_BOT_TOKEN: users:read, users:read.email) the site links an account when users.lookupByEmail for the private-profile email returns a full, active, human member of SLACK_TEAM_ID whose handle exactly equals slackSamlNameId. It runs one person at a time: about a minute after Slack SAML sign-in, on /me (waiting at most 1.5 s), and for up to 5 admins per feed request; at most 20 Slack calls a minute, honouring Retry-After; no-match cached 24 h, errors 15 min. Automatic links are re-verified when used past 24 h, always before an on-behalf decision (a mismatch removes the link; either failure refuses not_project_admin); the feed stops carrying an id unverified for 7 days. Links record via (auto | code) and verifiedAt; disconnecting records an opt-out the automatic path honours and a code link clears. The code stays as the fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
codeforphilly-bot
added a commit
that referenced
this pull request
Nov 30, 2026
…link (PR #270) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- slack-link: the code is 8 characters shown as two groups of four (the example had 7); the code response carries botDmUrl so the Account row can link the bot's name to a DM, as the screen asks; an account with no private profile is refused (the link lives there); redemption fails closed with no workspace configured; a 409 does not consume the code - auth: /me's slack field, which account.md already reads - conventions: the linking pair counts as credential endpoints - data-model: agent-grants contract is v2 (the new scopes change it) - agent-applications: application.visible is at notifiedAt (when the hold ended for a held one), so the cursor never skips it; events appear once a minute old; next is never null; where decidedBy, decidedVia and closedBy sit; the decide scope without its companions is refused at use (401), and a foreign workspace is not_project_admin - architecture: SLACK_TEAM_ID and SLACK_OPS_BOT_DM_URL Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n private profiles
AGENT_SCOPES gains slack:link, projects:applications:read and
projects:applications:decide, with AGENT_SCOPE_REQUIRES naming each
scope's companions. agent-grants/v2 is generated and vendored into the
API mirror (with gitsheets contracts adopt; provenance lands when the
data repo adopts from the published URL). PrivateProfile gains the
optional slack { teamId, userId, linkedAt }.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h profile rewrites bySlackUserId (teamId:userId → personId) is rebuilt with the other private indices, so a link, a disconnect or a purge is reflected at once. The profile rewrites on a GitHub email change, an account claim, a claim merge and a staff email edit rebuilt the profile field by field and would have dropped the link; they carry it now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
POST /api/account/slack-link/code issues an 8-character code (two groups
of four, no 0/O/1/I/L), hashed in memory for ten minutes, one live code
per person, five per hour. POST /api/agent/slack-links (slack:link)
redeems it for the Slack user who sent it: unknown, expired, used and
orphaned codes answer one 404 code_invalid, ten failures lock the agent
out for an hour, another workspace (or none configured) is 422, and a
Slack user linked elsewhere is 409 without spending the code. DELETE
/api/account/slack-link clears it. /api/auth/me reports { linked,
linkedAt }, never the user id. Minting enforces every scope's
companions; /api/agent/* routes check scope and companions before the
body (401). Both linking paths count as credential endpoints.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mint form Connect Slack asks for a code and shows it with the instruction to DM it to the ops bot within ten minutes (the bot's name links to botDmUrl when configured); the row polls /api/auth/me while the code is live and turns "Connected to Slack ✓ since …" when the bot confirms. Disconnect asks first. The row never shows a Slack user id. The agents panel's mint form offers the three new scopes and warns when decide lacks its companions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
projects:applications:read. Events are derived from the membership records on each read: application.visible at notifiedAt, .reminder at remindedAt, .accepted at decidedAt, .closed at closedAt. A held application, one withdrawn before admins could see it, and every event of a deactivated applicant or deleted project are left out. Each event names the project, the applicant's facts, the application (offer, needs, decidedBy, decidedVia, closedBy) and the active admins, with a Slack user id only for a verified link in this workspace; no email anywhere. Ordered by (at, record id, type) with a base64url cursor that survives a restart; 7-day default window; events show once a minute old, and the sweep stamps its notice bookkeeping when it commits rather than when it started, so nothing lands behind a cursor. hasSlackLink reads the typed field now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"The ops bot recorded that you accepted …", naming the agent, how to undo it, and a link to the Applications screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
POST /api/agent/applications/:projectSlug/:personSlug/decision under projects:applications:decide, which must hold its two companions at use (401 otherwise). onBehalfOf must name a Slack user in the configured workspace with a verified link to a person who is not deactivated, not an agent, and is a project-admin of this project right now, checked with the site's project-admin marker alone so staff powers do not carry over (403 not_project_admin otherwise). Checked before the lock to name the admin in the commit and again under it, with the 30-per-24-hours cap per agent across its grants (records plus an in-process log). The effect is the site's accept or close run as that admin, with decidedVia = agent and agentGrantId; the commit is the agent's with Actor-Kind, Grant-Id and On-Behalf-Of. Unknown body fields (isAdmin above all) are refused, not dropped. The applicant gets the usual email and the admin a confirmation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The three closeout commits were made before the pull request existed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Operator-approved on PR #270: the site links an account to a Slack user by itself when the user found by its email has the handle the site asserted at sign-in. Scope, approach and validation amended; the earlier closeout's ticks stand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…agree Operator-approved design on PR #270. With its own read-only token (SLACK_BOT_TOKEN: users:read, users:read.email) the site links an account when users.lookupByEmail for the private-profile email returns a full, active, human member of SLACK_TEAM_ID whose handle exactly equals slackSamlNameId. It runs one person at a time: about a minute after Slack SAML sign-in, on /me (waiting at most 1.5 s), and for up to 5 admins per feed request; at most 20 Slack calls a minute, honouring Retry-After; no-match cached 24 h, errors 15 min. Automatic links are re-verified when used past 24 h, always before an on-behalf decision (a mismatch removes the link; either failure refuses not_project_admin); the feed stops carrying an id unverified for 7 days. Links record via (auto | code) and verifiedAt; disconnecting records an opt-out the automatic path honours and a code link clears. The code stays as the fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e opt-out PrivateProfile.slack gains via (auto | code; absent means code) and verifiedAt; the profile gains slackAutoLinkOptOutAt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Behind an interface so tests use a fake. 429 and ratelimited become SlackRateLimitedError with Retry-After; users_not_found is null; anything else is SlackApiError carrying Slack's error string, never the email. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With SLACK_BOT_TOKEN and SLACK_TEAM_ID, the site links a person when the Slack user found for their private-profile email has a handle exactly equal to slackSamlNameId and is a full, active, human member of the workspace. Runs about a minute after Slack SAML sign-in, on /me (waiting at most 1.5 s), and for up to 5 admins per feed request; 20 Slack calls a minute site-wide, Retry-After honoured, no-match cached 24 h and errors 15 min, one attempt per person at a time; never throws to its caller. Automatic links past 24 h are re-checked when used and always before an on-behalf decision: a mismatch removes the link, and the decision is refused not_project_admin if the link is removed or could not be re-checked (resolved again under the write lock). The feed drops an automatic link unverified for 7 days. Code links record via=code and clear the opt-out; disconnecting records it. Profile rewrites carry the opt-out. me.slack reports via. The email is never logged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lly or made by code Disconnect's confirm says the site will not reconnect by itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…link (PR #270) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
codeforphilly-bot
force-pushed
the
feat/membership-slack-chain
branch
from
November 30, 2026 00:51
f70a81c to
b8ee18d
Compare
…2 adoption apps/api/gitsheets/ mirrors codeforphilly-data's empty branch after it adopts agent-grants/v2: sources.toml records the v2 provenance, and the v1 document no sheet declares any more goes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #269. Site side of the plans
slack-account-link,agent-application-feedandagent-decide-on-behalf. The bot side is not built yet and each plan still lists it underawaits:. Written by GrittyBot, an AI. 🧡🤖What it does
slackSamlNameId), and is a full, active, human member of the workspace. The site checks this itself with its own read-only Slack token. An agent never asserts it.GET /api/agent/eventsgives an agent application events with the project's admins and their linked Slack ids. Never an email address. Held applications and deactivated people do not appear.On-Behalf-Of. The admin gets a confirmation email for each decision. Capped at 30 a day per agent.How the automatic link behaves
/api/auth/mefor a signed-in person with no link, and when the feed needs an admin's Slack id (at most 5 lookups per request).Read first
apps/api/src/services/slack-auto-link.tsandapps/api/src/slack/directory.tsapps/api/src/services/agent-decision.tsandapps/api/src/routes/agent-applications.tsapps/api/src/auth/caller.ts(agentScopeCaller)apps/api/src/services/slack-link.tsandapps/api/src/services/agent-feed.tsslack-auto-link,agent-decision,slack-link,agent-feed5052021and82d00efTo deploy
agent-grants/v2. No migration, it only adds scope values.SLACK_TEAM_IDandSLACK_BOT_TOKEN. The token is for a new Slack app of the site's own with exactlyusers:readandusers:read.email. Without both, automatic linking is off and code linking still works. OptionallySLACK_OPS_BOT_DM_URL.slack:link,projects:applications:readandprojects:applications:decide.Open points
not_project_admin, not a retryable 503.Not verified
🤖 Generated with Claude Code